<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<nav class="navbar navbar-expand-sm bg-dark navbar-dark">
    <a class="navbar-brand" href="${pageContext.request.contextPath}">商品清单</a>

    <ul class="nav ml-auto" style="margin-right: 150px">
        <c:choose>
            <c:when test="${empty sessionScope.id}">
                <li class="nav-item">
                    <a class="nav-link btn btn-light" onclick="showFrame('${pageContext.request.contextPath}/user/login',500,400)">登录</a>
                </li>
            </c:when>
            <c:otherwise>
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#">${sessionScope.user}</a>
                    <div class="dropdown-menu">
                        <c:if test="${sessionScope.type==1}">
                            <a class="dropdown-item" target="_blank"
                               href="${pageContext.request.contextPath}/admin/manageProduct/1">后台管理</a>
                        </c:if>
                        <a class="dropdown-item" onclick="showFrame('${pageContext.request.contextPath}/user/modify/',500,400)">修改个人信息</a>
                        <a class="dropdown-item" href="${pageContext.request.contextPath}/user/logout">登出</a>
                    </div>
                </li>
            </c:otherwise>
        </c:choose>
    </ul>
</nav>

<script src="${pageContext.request.contextPath}/static/js/showFrame.js"></script>
